package com.tengju.data.infrastructure.repository.clickhouse.convert;

import com.tengju.data.domain.model.clickhouse.BrandId;
import com.tengju.data.domain.model.clickhouse.brand.BrandMarketSortInfo;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.BrandMarketSortDO;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Date: 2021/5/12 11:09
 * @Description: 
 */
public class BrandMarketSortConvert {

    public static List<BrandMarketSortInfo> toModelList(List<BrandMarketSortDO> doList) {
        List<BrandMarketSortInfo> infoList = new ArrayList<>();
        if (CollectionUtils.isEmpty(doList)) {
            return infoList;
        }

        for (BrandMarketSortDO sortDO : doList) {
            BrandMarketSortInfo info = new BrandMarketSortInfo(new BrandId(sortDO.getBrandId()),
                    sortDO.getBrandName(),sortDO.getMonthGmv(),sortDO.getQuarterGmv(),
                    sortDO.getMonthDealerMembers(),sortDO.getQuarterDealerMembers(),
                    sortDO.getMonthDealerRatio(),sortDO.getQuarterDealerRatio());

            infoList.add(info);
        }

        return infoList;
    }

}
